\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\usepackage{hyperref}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}

\definecolor{gray}{rgb}{0.9,0.9,0.9}% Wir definieren im RGB-Farbraum
\newcommand{\cbox}[5]{\colorbox{gray}{\parbox{15cm}{
\subsubsection{\large #1}
\small
\begin{description} 
\item[Expects] #2
\item[Returns] #3
\item[Description] #4
\item[Exemple] #5
\end{description}
}}\newline}

\author{Emanuel May}
\title{OpenRPGStudio - Manual}

\begin{document}

\maketitle
\tableofcontents

\pagebreak

\part{Manual}

\section{What is OpenRPGStudio?}

OpenRPGStudio is an application to create stunning oldschool 2D Roleplaying Games, inspired by the RPG-Maker series by Enterbrain. It is entirely written in Java 7 and both the Editor part and the created Game part are multiplatform and run on every platform supporting full Java 7 (WinXP-7, Linux, Mac OS X).

\textbf{You don't need to know how to program Java!}

This application and the games are written in Java, but you don't need to write a single line of code to create your own RPG! All events in the games are described in an easy to learn scripting language named Lua. The clue is: You don't even have to learn Lua to create a complex RPG with OpenRPGStudio, because unlike other game-creation tools every aspect of the scripting language can be accessed in a clean and user friendly interface. You \emph{can} write everything down in Lua, but you can get the same results when you are using our GameEditor's complex menues.

The best part of OpenRPGStudio is: \textbf{It is completely free and open source! It is licensed under GPLv2, which means you can look over every part of the source code by yourself or create your own branch of the software, if you know how to program in Java.}

\section{Features}

As OpenRPGStudio is in an early state of development not all features are implemented at the moment. Here you can look at all the features that are already implemented or beeing planned.

\begin{description}
\item[Lua Scripting Engine] 25\%
\item[Game Engine] 5\%
\item[Game Editor] 15\%
\item[Database] 20\%
\end{description}

\section{GameEditor}

The GameEditor is the main part of OpenRPGStudio. You will use this application to create your game, edit the scripts, import and export sprites, music and sound files. There are two major parts (and a few minor ones) of GameEditor you will use very often: The Map Editor and the Database Editor. This manual uses the Sample Game to show all of the features of GameEditor.

\subsection{Main Window}

\subsection{Database Editor}

\subsection{Map Editor}

\subsection{Media Manager}

\subsection{Other features and tips \and tricks}

\part{Script Reference}

\section{What is this?}

This is a quick reference on all lua script commands used to create your own game in OpenRPGStudio. These commands are used in the script files describing your game, like creating heroes, items or npcs. Every chest, battle or dialoge is scripted in Lua. But don't panic! Even if you are a programming newbie, you can easily create quality roleplaying games with our tool, because every script command can be accessed in our user friendly GUI. There you can load maps or backgrounds, set the player group and entities, like npcs or monsters - even if you don't know how to script!

For those who like to learn scripting in Lua we can strongly recommend this tutorial:\\ \url{http://lua.gts-stolberg.de/en/index.php}

Keep reading for a quick reference on all OpenRPGStudio related commands! For a complete Lua reference with all original Lua commands check:\\ \url{http://www.lua.org/}

\section{Lua Reference}

\subsection{InitHero class (heroes.lua)}

Initializes the Hero objects for the start of the game. This class is only used in the \texttt{heroes.lua} file. The script in this file will be executed at launchtime of the game. It fills the ingame database with any infos about all the playable (and non-playable) Heroes and their starting values.\newline

\cbox{newHero(x)}{String x = Name of the new hero}{(int) index of new hero}{Creates a new Hero entity in the database of the game. You can have multiple Heroes with the same name, because every new Hero gets a new ID in the database. This function returns the new ID, if the creation was successful.} {\emph{InitHero.newHero('Max')} -- creates a new Hero called Max}

\cbox{setName(x,y)}{int x = index of Hero, String y = new name of Hero}{nil}{Sets a new name for a existing Hero. You won't need this normally.} {\emph{InitHero.setName(0,'Peter')} -- sets Hero \#0's name to Peter.}

\cbox{setMaxLvl(x,y)}{int x = index of Hero, int y = maximum experience level of Hero}{nil}{Sets the maximum experience level of an existing Hero. This can be anything above 1.}{\emph{InitHero.setMaxLvl(0,50)} -- sets the maximum level of this Hero to 50.}

\cbox{setStartLvl(x,y)}{int x = index of Hero, int y = start experience level of Hero}{nil}{Sets the beginning experience level of an existing Hero. This can be anything above 0 and equal or below the maximum level of this Hero.}{\emph{InitHero.setStartLvl(0,5)} -- sets the start level of this Hero to 5, which means he begins the adventure at this level.}

\cbox{setExpFormula(x,y)}{int x = index of Hero, String y = a string describing a mathematical function}{nil}{This function is a tricky, but very important one. You need to set a mathematical function which will return a number for a given integer. This can be anything you want, but we recommend linear or square functions. A square function like \emph{a * (x - 1) + b} helps you keep track of values. The \emph{a} equals the multiplyer of the function and the \emph{b} equals the value on level 1.}{\emph{InitHero.setExpFormula(0,'15 * (x-1)\^{ }2 + 33')} -- creates a new formula for the experience curve of the Hero. \emph{Tip: Try \& Failure is a good method to find good functions.}}

\cbox{addAttribute(x,y,z)}{int x = index of Hero, String y = name of the attribute, String z = a string describing a mathematical function}{'true' if the attribute was added, 'false' if an attribute with this name already exists}{Creates a new Attribute for the Hero, like 'Strength' or 'Health'. The Attribute needs a mathematical function, like the ExpFormula (s.a.)}{\emph{InitHero.addAttribute(0,'Magic', '0.5 * (x-1)\^{ }2 + 35')} -- creates a new 'Magic' attribute and sets a formula to generate values for each level of the Hero.}

\subsection{InitItemType class (itemtypes.lua)}

Initializes the ItemType objects for the start of the game. This class is only used in the \texttt{itemtypes.lua} file. The script in this file will be executed at launchtime of the game. It fills the ingame database with any infos about item classifications.\newline

\cbox{newItemType(x)}{String x = unique identifier string of the ItemType}{(int) index of new ItemType}{Creates a new ItemType, which represent an item category like medicine or equipment.}{\emph{InitItemType.newItemType('Helmet')} -- creates a new ItemType with the name 'Helmet'}

\cbox{isUsable(x,y)}{int x = index of ItemType, boolean y = flag true or false}{nil}{Flags the ItemType to be usable in menu or the map screen.}{\emph{InitItemType.isUsable(0,true)} -- sets the ItemType with the ID 0 to 'usable from menu'}

\cbox{isUsableInBattle(x,y)}{int x = index of ItemType, boolean y = flag true or false}{nil}{Flags the ItemType to be usable in battle.}{\emph{InitItemType.isUsableInBattle(0,false)} -- sets the ItemType with the ID 0 to 'not usable in battle'}

\cbox{isEquipable(x,y)}{int x = index of ItemType, boolean y = flag true or false}{nil}{Flags the ItemType to be equipable.}{\emph{InitItemType.isEquipable(0,false)} -- sets the ItemType with the ID 0 to 'equipable by hero'}

\cbox{isSellable(x,y)}{int x = index of ItemType, boolean y = flag true or false}{nil}{Flags the ItemType to be sellable to npcs or shops.}{\emph{InitItemType.isSellable(0,false)} -- sets the ItemType with the ID 0 to 'not sellable to anyone'}

\subsection{InitItem class (items.lua)}

Initializes the Item objects for the start of the game. This class is only used in the \texttt{items.lua} file. The script in this file will be executed at launchtime of the game. It fills the ingame database with any infos about Items and Equipment.\newline

\end{document}